package org.example.design.factory.itf.impl;

import cn.hutool.json.JSONUtil;
import org.example.design.factory.Card.IQiYiCardService;
import org.example.design.factory.itf.Commodity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * @Classname CardCommdityService
 * @Description 兑换卡实现类
 * @Date 2020/10/30 11:28 上午
 * @Created by xiangjd
 */
public class CardCommdityService implements Commodity {

    private Logger logger = LoggerFactory.getLogger(CardCommdityService.class);

    // 模拟注入
    private IQiYiCardService iQiYiCardService = new IQiYiCardService();

    @Override
    public void SendCommidIty(String userId, String commId, String bizId, Map<String, String> extMap) throws Exception {

        String mobileFhoneNumber = queryUserMobile(userId);
        iQiYiCardService.grantToken(mobileFhoneNumber, commId);
        logger.info("请求参数【爱奇艺会员卡】:userid:{},commid:{},:bizId:{},extMap:{}", userId, commId, bizId, JSONUtil.toJsonStr(extMap));
        logger.info("测试结果【爱奇艺会员卡】:success");


    }


    private String queryUserMobile(String uId) {
        return "15200101232";
    }
}
